package com.viu.technology.controller;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController()
@RequestMapping("/rabbit")
public class RabbitController {

    @Autowired
    AmqpTemplate rabbitTemplate;


    @GetMapping("/testRabbitThread")
    public String testRabbitThread() {
        rabbitTemplate.convertAndSend("spring.boot.rabbit.test", "asdfasdf");
        return "success";
    }

    @GetMapping("/test")
    public String test() {
        return "success";
    }
}
